#! /usr/bin/env python
from sqlite3 import dbapi2 as sqlite

flist = ["Date", "First", "Second", "Third", "Fourth", "Fifth","Powerball"]

conn = sqlite.connect("lotto-hist")
conn.row_factory = sqlite.Row
curs = conn.cursor()
conn.text_factory = sqlite.OptimizedUnicode

def update_history(date, first, second, third, fourth, fifth, powerball):
    #update the main table first
    curs.execute("INSERT into history values(?, ?, ?, ?, ?, ?)", date, first, second, third, fourth, fifth, powerball)
    curs.execute("Insert into dates values(?)", date)
    